#!/bin/bash

git pull --rebase
today=`date +"%Y-%m-%d"`
mkdir -p $today
> $today/hosts
echo "# Copyright (c) 2018-3018, moondark." >> $today/hosts
echo "# https://gitee.com/moondark/getHost" >> $today/hosts
echo "# Last updated: $today" >> $today/hosts

./getHost.sh >> $today/hosts
rm -rf hosts
ln -s $today/hosts hosts
git add -A
git commit -s -m "update $today"
git push
